﻿@{
    ViewBag.PageTitle = "支付结果 - " + ViewBag.site.SeoTitle;
    ViewBag.PageKeyword = ViewBag.site.SeoKeyword;
    ViewBag.PageDescription = ViewBag.site.SeoDescription;
}
<!--导航菜单.开始-->
<div class="wrapper">
    <div class="location">
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item>首页</el-breadcrumb-item>
            <el-breadcrumb-item>在线支付</el-breadcrumb-item>
            <el-breadcrumb-item>支付结果</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
</div>
<!--导航菜单.结束-->

<div class="wrapper">
    <div class="payment-box">
        <div class="head-box">
            <div v-if="orderModel.paymentStatus==1" class="title">
                <span class="icon iconfont icon-check"></span>
                <span>订单支付成功</span>
            </div>
            <div v-else class="title">
                <span class="icon iconfont icon-close"></span>
                <span>订单支付失败！</span>
            </div>
            <div class="item-box">
                <div class="item">
                    <div class="left">订单编号</div>
                    <div class="right">{{orderModel.orderNo}}</div>
                </div>
                <div class="item">
                    <div class="left">订单金额</div>
                    <div class="right">
                        <span class="price">{{orderModel.orderAmount}}</span>元
                    </div>
                </div>
            </div>
            <div class="btn-box">
                <el-button type="warning" class="btn" @@click="common.linkUrl(orderModel.linkUrl)">查看订单</el-button>
                <el-button type="danger" class="btn" @@click="common.linkUrl('/account')">会员中心</el-button>
            </div>
        </div>
    </div>
</div>

@section Scripts{
    <script>
        //初始化VUE
        var ve = new Vue({
            el: '#app',
            data: {
                orderModel: {
                    id: 0,
                    orderNo: null,
                    orderAmount: 0,
                    paymentId: 0,
                    paymentStatus: 1,
                    linkUrl: null
                }
            },
            methods: {
                //加载订单信息
                async initData(no) {
                    let _this = this;
                    if (!no) {
                        this.$alert('订单参数有误，请检查重试', '错误提示', {
                            confirmButtonText: '确定',
                            callback: action => {
                                common.back(-1);
                            }
                        });
                        return;
                    }
                    if (no.startsWith("RN")) {
                        await AxiosAjax({
                            url: `/account/rechargeno/${no}`,
                            success: function (res) {
                                _this.orderModel.id = res.data.id;
                                _this.orderModel.orderNo = res.data.recharge;
                                _this.orderModel.orderAmount = res.data.amount;
                                _this.orderModel.paymentId = res.data.paymentId;
                                _this.orderModel.paymentStatus = res.data.status;
                                _this.orderModel.linkUrl = "/account/recharge/list";
                            }
                        });
                    } else {
                        await AxiosAjax({
                            url: `/account/orderno/${no}`,
                            success: function (res) {
                                _this.orderModel.id = res.data.id;
                                _this.orderModel.orderNo = res.data.orderNo;
                                _this.orderModel.orderAmount = res.data.orderAmount;
                                _this.orderModel.paymentId = res.data.paymentId;
                                _this.orderModel.paymentStatus = res.data.paymentStatus;
                                _this.orderModel.linkUrl = `/account/order/show/${_this.orderModel.id}`;
                            }
                        });
                    }
                },
            },
            created() {
                let orderNo = common.queryValue("no");
                this.initData(orderNo);
            }
        })
    </script>
}